package com.atguigu.gmall.all.controller;

import com.atguigu.gmall.model.order.OrderInfo;
import com.atguigu.gmall.order.client.OrderFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

/**
 * @author gsy
 * @date 2021年09月14日10:12
 * Description
 */
@Controller
public class PayController {
    @Autowired
    private OrderFeignClient orderFeignClient;


    //去支付页面
    @GetMapping("/pay.html")
    public String pay(Long orderId, Model model) {
        //查询订单金额及其相关信息
        OrderInfo orderInfo = orderFeignClient.getOrderInfo(orderId);
        model.addAttribute("orderInfo", orderInfo);
        return "payment/pay";
    }

    //跳转到支付成功页面
    @GetMapping("/pay/success.html")
    public String paySuccess() {
        return "payment/success";
    }
}
